const path=require('path');
const { defineConfig } = require('@vue/cli-service')

// vant按需引入配置
const { VantResolver } = require('@vant/auto-import-resolver');
const ComponentsPlugin = require('unplugin-vue-components/webpack');

// gzip压缩插件
const ComporessPlugin = require('compression-webpack-plugin');

module.exports = defineConfig({
  lintOnSave: false,
  transpileDependencies: true,
  // 配置vant按需引入
  configureWebpack: {
    plugins: [
      // 配置vant组件库按需引入
      ComponentsPlugin({
        resolvers: [VantResolver()],
      }),
      // 开启gzip压缩
      new ComporessPlugin()
    ],
    resolve: {
      alias:{
        "@":path.resolve(__dirname,'src')
      },
      // 配置省略后缀
      extensions: ['.js', '.jsx', '.json', '.vue']
    }
  },
})
